package com.example.rfidserver.consume.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.rfidserver.R;
import com.example.rfidserver.pojo.Consume;

import java.util.List;

public class SiteConsumeAdapter extends BaseAdapter {


    //服务项
    private List<Consume> services;
    private Context context;
    public SiteConsumeAdapter(Context context,List<Consume> user){
        super();
        this.services = user;
        this.context = context;
    }


    @Override
    public int getCount() {
        return services.size()==0?0:services.size();
    }

    @Override
    public Consume getItem(int position) {
        return services.get(position)==null?null:services.get(position);
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        //膨胀器?
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.item_list_siteconsumemanager,null);
        final TextView siteconsumemanager_consume_id = view.findViewById(R.id.siteconsumemanager_consume_id);
        final TextView siteconsumemanager_consume_item = view.findViewById(R.id.siteconsumemanager_consume_item);
        final TextView siteconsumemanager_item__integral = view.findViewById(R.id.siteconsumemanager_item__integral);
        siteconsumemanager_consume_id.setText("服务项id:"+getItem(position).getConsume_id());
        siteconsumemanager_consume_item.setText("服务项名:"+getItem(position).getConsume_Item_name());
        siteconsumemanager_item__integral.setText("该服务积分为:"+getItem(position).getConsume_Item_integral());
        return view;
    }




}
